package com.zzccyy.jpdemo.utils;

import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zzccyy.jpdemo.R;
import com.zzccyy.jpdemo.bean.SearchListBean;

import java.util.List;


public class ListAdapter3 extends BaseQuickAdapter<SearchListBean.DataBean.ListBean.TicketListBean, BaseViewHolder> {


    private final Context activity;



    public ListAdapter3(Context activity,  int layoutResId) {
        super(layoutResId);
        this.activity = activity;
    }
    
    @Override
    protected void convert(BaseViewHolder helper, SearchListBean.DataBean.ListBean.TicketListBean item) {
        TextView ttt1 = helper.getView(R.id.ttt1);
        TextView ttt2 = helper.getView(R.id.ttt2);
        TextView ttt3 = helper.getView(R.id.ttt3);
        if (!TextUtils.isEmpty(item.name)){
            ttt1.setText(item.name);
        }
        if (!TextUtils.isEmpty(item.price)){
            ttt3.setText("¥"+ item.price +"起");
        }
        if (!TextUtils.isEmpty(item.num)){
            ttt2.setText(item.num);
            if (item.num.equals("无")){
                ttt2.setTextColor(ContextCompat.getColor(activity, R.color.color_999999));
            }else {
                ttt2.setTextColor(ContextCompat.getColor(activity, R.color.color_4ece43));
            }
        }
    }
}

